package com.tools.module.sys.enums;

import java.util.ArrayList;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.List;

public enum YearEnum {
    YEAR_STATUS_ONE(0, "一年"), YEAR_STATUS_TOW( 1, "两年"), YEAR_STATUS_THREE(2, "三年"), YEAR_STATUS_FOUR(3, "四年"), YEAR_STATUS_FIVE(4,"五年");

    private Integer code;
    private String value;

    YearEnum(Integer code, String value) {
        this.code =  code;
        this.value =  value;
    }


    /**
     * 获取集合List
     * @return
     */
    public static List<HashMap<String,String>> getAdPositionList() {
        List<HashMap<String, String>> list = new ArrayList<>();
        for (YearEnum yearEnum : EnumSet.allOf(YearEnum.class)) {
            HashMap<String, String> map = new HashMap<>();
            map.put("code",yearEnum.code.toString());
            map.put("name",yearEnum.value);
            list.add(map);
        }
        return list;
    }
}
